This invention relates to an interrupt mechanism for an operating system. It relates to an interrupt mechanism suitable, in particular, for use with a real-time operating system which is portable. It also relates to an operating system including such an interrupt mechanism, to a data processing system including such an interrupt mechanism and to a method of processing interrupts.
In a conventional interrupt mechanism which is typically used in non real-time systems such as the UNIX operating system, interrupt processing is provided at a hardware interrupt level. (UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.) In such an interrupt mechanism, interrupts are typically allocated one of a number of different interrupt levels, for example eight, where 0 is the highest level and 7 is the lowest level. When an interrupt of a given level (say level 4) is being processed, an interrupt of a higher level (say level 2) can pre-empt (interrupt) the processing of the level 4 interrupt, whereby the level 2 interrupt is completed before processing of the level 4 interrupt is completed. A disadvantage of this approach is, however, that when the interrupt of a given level (say level 4) is being processed, lower level interrupts are masked. The masking of lower level interrupts is disadvantageous, particularly in real-time systems, as it prevents real-time processing of the interrupts.
An alternative approach to the handling of interrupts, which finds application to real-time operating systems, employs the use of interrupt threads. An example of a real time operating system which uses interrupt threads to process interrupts is the CHORUS/ClassiX operating system. This operating system is largely written in high level computer language to be hardware independent and comprises the minimum of hardware dependent "glue" code. An interrupt thread having a very short critical section is used to process interrupts rather than performing this at the interrupt level itself. Specifically, an interrupt handler wakes up a high priority thread (an interrupt thread) using a binary semaphore. The interrupt thread which has been activated carries out the necessary tasks and then control can be returned to the interrupted thread. Although this approach is better than a hardware level approach in a real-time environment (as there is no masking of interrupts), it is still not entirely satisfactory due to the delays involved in rescheduling, i.e. in switching from the interrupted thread to the interrupt thread and then back again.
In a real time system, particularly but not exclusively in environments which require high interrupt handling performance, for example for telecommunications industry environments, there is a need to optimise interrupt handling as much as possible. A conventional approach for optimising critical software components in computing systems is to use low level (assembler) code to provide the necessary processing functionality. However, this approach is not available if it is intended to provide an operating system which can be ported to different hardware environments with the minimum of modification. In order to be portable, the operating system has substantially to be generic to all environments with as little as possible "glue" code to attach the generic operating system to a specific hardware base.
Accordingly, there is a need for an interrupt mechanism which can improve interrupt handling, particularly in the context of a real-time portable operating system.